# Table 3

rm(list=ls(all=TRUE))

require(survival)
require(stargazer)

#### Datasets ####
setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Data Rep")
load("data_empirics_survival_rep.Rdata") 

#### MODEL 4.1 - MODEL 4.6: Cox ####

model_4.1 <- coxph(Surv(time_elapsed) ~ female_dum + ideology_ext +
                     committee_chair + seniority + type_member +
                     party_match_pres +
                     election_year + length_speech_combined_100 +
                     tot_num_speeches_session_10 + mean_length_leg +
                     negative_lang_leg_session + dum_mujeres_session +
                     interruption_dummy_session
                   , data = data_empirics_survival)

model_4.2 <- coxph(Surv(time_elapsed) ~ female_dum + ideology_ext +
                     committee_chair + seniority + type_member +
                     party_match_pres +
                     election_year + length_speech_combined_100 +
                     tot_num_speeches_session_10 + mean_length_leg +
                     negative_lang_leg_session + dum_mujeres_session +
                     interruption_dummy_session + interruption_dummy_session*female_dum
                   , data = data_empirics_survival)

model_4.3 <- coxph(Surv(time_elapsed) ~ female_dum + ideology_ext +
                     committee_chair + seniority + type_member +
                     party_match_pres +
                     election_year + length_speech_combined_100 +
                     tot_num_speeches_session_10 + mean_length_leg +
                     negative_lang_leg_session + dum_mujeres_session +
                     procedural_dummy_session 
                   , data = data_empirics_survival)

model_4.4 <- coxph(Surv(time_elapsed) ~ female_dum + ideology_ext +
                     committee_chair + seniority + type_member +
                     party_match_pres +
                     election_year + length_speech_combined_100 +
                     tot_num_speeches_session_10 + mean_length_leg +
                     negative_lang_leg_session + dum_mujeres_session +
                     procedural_dummy_session + procedural_dummy_session*female_dum 
                   , data = data_empirics_survival)

model_4.5 <- coxph(Surv(time_elapsed) ~ female_dum + ideology_ext +
                     committee_chair + seniority + type_member +
                     party_match_pres +
                     election_year + length_speech_combined_100 +
                     tot_num_speeches_session_10 + mean_length_leg +
                     negative_lang_leg_session + dum_mujeres_session +
                     aggressive_dummy_session 
                   , data = data_empirics_survival)

model_4.6 <- coxph(Surv(time_elapsed) ~ female_dum + ideology_ext +
                     committee_chair + seniority + type_member +
                     party_match_pres +
                     election_year + length_speech_combined_100 +
                     tot_num_speeches_session_10 + mean_length_leg +
                     negative_lang_leg_session + dum_mujeres_session +
                     aggressive_dummy_session + aggressive_dummy_session*female_dum 
                   , data = data_empirics_survival)

#### TABLE 4: Time after an interruption ####
setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Table")

stargazer(model_4.1,model_4.2,model_4.3,model_4.4,model_4.5,model_4.6,
          type = "html", style = "ajps", out = "table4.html",
          covariate.labels = c("Woman","Ideological Extremism","Committee Chair",
                               "Seniority","National MC","Same Party as Leg. Pres.",
                               "Election Year", "Length of Speech","Speeches during Debate",
                               "Mean Length of MC Speech",
                               "Negative Language (Speech)",
                               "Topic: Women",
                               "Interruptions (All)", "Woman x Interruptions (All)",
                               "Procedural Interruptions",
                               "Woman x Procedural Interruptions",
                               "Aggressive Interruptions",
                               "Woman x Aggressive Interruptions"),
          omit = "factor",
          no.space=TRUE,
          dep.var.labels=c("Time Lapsed"),
          digits=3,
          df = FALSE,
          keep.stat = c("theta", "n"))
